package cn.qayy.service;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.bind.annotation.RequestParam;

import com.github.pagehelper.PageInfo;

import cn.qayy.dto.CountryOver1k;
import cn.qayy.dto.PlanVo;
import cn.qayy.dto.PlansDTO;
import cn.qayy.dto.TerminalOver1k;
import cn.qayy.dto.calsum;
import cn.qayy.po.Plan;

/**
 * @author wangyu 流向接口
 */
public interface IPlanService extends BasicService{
	
	/***
	 * 分组查询 mgr, terminal, commercial1, zhenghe_qs, fenbu, daibiao, tichengbelong, client
	 * @param params
	 * @return
	 */
	List<Map<String, String>> selectGroup() throws Exception;
	/***
	 * 分页查询
	 * @param params
	 * @return
	 */
	PageInfo<Map<String, Object>> selectPlanBy(Map<String, Object> params) throws Exception;

	/***
	 * 通过id查询流向
	 * @param params
	 * @return
	 */
	Plan selectPlanByID(@RequestParam Integer planId) throws Exception;
	/***
	 * 查询真自然流keys
	 * @return
	 */
	List<String> findRealNaturalFlowKeys(Map<String, Object> params) throws Exception;
	
	int updateStatus(Map<String,Object> statusMap) throws Exception;
	
	public int changeTerminal (Map<String,Object> keyMap) throws Exception;
	
	/***
	 * 查询流向
	 * @param params
	 * @return
	 */
	List<Plan> selectByMap(Map<String, Object> params) throws Exception;
	
	/***
	 * 查询好伙伴
	 * @param params
	 * @return
	 */
	List<Map<String, Object>> selectGoodfriendByMap(Map<String, Object> params) throws Exception;
	/***
	 * 查询重点终端
	 * @param params
	 * @return
	 */
	List<Map<String, Object>> selectFocusByMap(Map<String, Object> params) throws Exception;
	/***
	 * 更新勘误表时，同步更新同名的入货乙方对应的QS名、类型、级别属性
	 * @param updateOtherYiFan
	 */
	void updateOther(List<Plan> updateOtherYiFan);
	/***
	 * 商业公司作为乙方时的库存情况项
	 * @param params
	 * @return
	 */
	List<Plan> selectYifanKuCun(Map<String, Object> params);
	/***
	 * 商业公司作为甲方时的库存情况项
	 * @param params
	 * @return
	 */
	List<Plan> selectJiafanKuCun(Map<String, Object> params);
	
	/***
	 * 通过list 批量更新,没有限制的更新，毕的也可以更新
	 * @param list
	 * @return
	 */
	int updateByListNoLimit(List<Plan> list,HttpServletRequest request) throws Exception;
	/***
	 * 通过list id 批量删除
	 * @param list
	 * @return
	 */
	int deleteByIdList(List<String> idList) throws Exception;
	
	calsum selectSumBy(Map<String, Object> params);
	/**
	 * 查询用空格隔开的id
	 * @param params
	 * @return
	 */
	List<Integer> selectIdsByMap(Map<String, Object> params);
	/***
	 * 查询月均过千盒的区县
	 * @param params
	 * @return
	 */
	List<CountryOver1k> selectCountryOver1k(Map<String, Object> params);
	/***
	 * 查询月均过千盒的终端
	 * @param params
	 * @return
	 */
	List<TerminalOver1k> selectTerminalOver1k(Map<String, Object> params);
	List<calsum> selectSumByMode(Map<String, Object> params);
	
	/***
	 * 持久化
	 * @param map
	 * @param request
	 * @param object
	 */
	void persistence(Map<String, List<Uploadable>> map, HttpServletRequest request, HttpServletResponse response) throws Exception;
	/**
	 * 无毕的限制，更新流向
	 * @param list
	 * @throws Exception
	 */
	int updateNomit(List<Plan> list,HttpServletRequest request) throws Exception;
	
	public PageInfo<Plan> selectBy(PlanVo dto) throws Exception;
}
